package week1exercises;

public class Triangle {

    public static String singleAsterisk() {
        return "*";
    }

    public static String horizontalLine(int n) {
        return horizontalLine(n, "*");
    }

    public static String horizontalLine(int n, String c) {
        String retVal = "";
        if (n >= 0)
            for (int i = 0; i < n; i++)
                retVal = retVal.concat(c);
        return retVal;
    }

    public static String verticalLine(int n) {
        String retVal = "";
        if (n > 0)
            for (int i = 0; i < n; i++)
                retVal = retVal.concat("*\n");
        return retVal;
    }

    public static String rightTriangle(int n) {
        String retVal = "";
        if (n > 0)
            for (int i = 0; i < n; i++) {
                retVal = retVal.concat(horizontalLine(i+1).concat("\n"));
            }
        return retVal;
    }
}
